package project.taobao.commons.activemq.listener;

import org.springframework.jms.support.converter.MessageConversionException;
import project.taobao.commons.activemq.template.ActiveMqTemplate;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;

public class MessageReceiver implements MessageListener {
    @Override
    public void onMessage(Message m) {
        String data = "";
        try {
//            data = ((TextMessage) m).getText();
            System.out.println(ActiveMqTemplate.consumerMessage("jjj"));
        } catch (MessageConversionException e1) {
            e1.printStackTrace();
        }
//        System.out.println("消费消息:" + data);
    }
}